1. Field of the Invention
The present invention is directed to computer systems. More particularly, it is directed to synchronization mechanisms for computer systems implementing transactional memory.
2. Description of the Related Art
In the field of computer systems, considerable effort has been expended on developing techniques to support concurrent access to shared resources. Mutual exclusion locks and monitors represent two traditional concurrent programming synchronization mechanisms. Locks and monitors protect shared resources by separating access to them in time; for example, in one implementation, as long as a given thread of execution retains a lock on an object or resource, no other thread of execution may modify the object, and any other thread attempting to modify the object may be blocked from further execution until the lock is released.
However, locking techniques are known to suffer from several limitations. Coarse-grained locks, which protect relatively large amounts of data, often do not scale. For example, threads of execution on a multiprocessor system may block each other even when they do not actually require concurrent access to the same data. Fine-grained locks may resolve some of these contention issues, but only at the cost of added programming complexity and the increased likelihood of problems such as deadlocks. Locking schemes may also lead to an increased vulnerability to thread failures and delays—e.g., a thread that is preempted or does expensive input/output operations while holding a lock may obstruct other threads for relatively long periods, thereby potentially reducing the overall throughput of the system.
The transactional-memory programming paradigm has been gaining momentum as an approach of choice for replacing locks in concurrent programming. In transactional-memory programming, sequences of concurrent operations may be combined into nonblocking atomic transactions, thus making parts of the code appear to be sequential without the need to use locks. Executing threads indicate transaction boundaries, e.g., by specifying when a transaction starts and when it ends, but do not have to acquire locks on any objects. Transactional-memory programming techniques may allow transactions that do not overlap in data accesses to run uninterrupted in parallel; transactions that do overlap may be aborted and retried.
The atomicity and isolation of transactions may significantly simplify concurrent programming. Atomicity is a property that guarantees that either all steps in a transaction succeed, or the entire transaction is rolled back, thus giving the impression that the transaction never occurred. Isolation refers to the ability of a transactional system to make operations in a transaction appear isolated from all other transactions or external operations. While attractive from the perspective of decreasing programming complexity, strict isolation may have some negative implications for transactional-memory systems: e.g., it may prevent interactions between transactions. Such interactions may be useful for several purposes, such as implementing condition synchronization and increasing concurrency. Synchronization techniques that allow such interactions may make it easier to implement increased parallelism within transactions, thereby potentially enhancing system-wide throughput in transactional-memory systems, and may provide a way for some transactions to share modified values of data prior to committing without compromising isolation for other transactions that do not need to share uncommitted data.